package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.service.DamageListGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * @author fenge
 */
@Controller
@RequestMapping("damageListGoods")
public class DamageListGoodsController {

    @Autowired
    private DamageListGoodsService damageListGoodsService;

    @PostMapping("save")
    @ResponseBody
    public ServiceVO save(DamageList damageList, String damageListGoodsStr, HttpSession session){
        damageListGoodsService.save(damageList,damageListGoodsStr,session);
        return new ServiceVO(100,"请求成功");
    }

    @PostMapping("goodsList")
    @ResponseBody
    public Map<String,Object> goodsList(Integer damageListId){
        return damageListGoodsService.goodsList(damageListId);
    }

    @PostMapping("list")
    @ResponseBody
    public Map<String,Object> list(String  sTime, String  eTime){
        return damageListGoodsService.list(sTime, eTime);
    }
}
